﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Knlght.Domain
{
    public class ActionResponse : ResponseBase
    {
        /// <summary>
        /// 回复 构造函数
        /// </summary>
        public ActionResponse(bool isSuccess = true, string error = "", int resultCode = ResultCodeConstants.NONE) : base(isSuccess, error, resultCode)
        { }

        #region 辅助方法
        /// <summary>
        /// 获取没有授权的操作回复对象
        /// </summary>
        public static ActionResponse CreateResponseByNotAuthorize()
        {
            return new ActionResponse(false, "没有授权", ResultCodeConstants.ERROR_NOAUTHORIZE);
        }
        readonly static ActionResponse SucccessActionResponse = new ActionResponse(true, "", ResultCodeConstants.SUCCESS);
        /// <summary>
        /// 获取操作成功的回复对象
        /// </summary>
        public static ActionResponse CreateResponseBySuccess()
        {
            return SucccessActionResponse;
        }
        /// <summary>
        /// 获取操作失败的回复对象
        /// </summary>
        public static ActionResponse CreateResponseByFail(string error, int resultCode = ResultCodeConstants.NONE)
        {
            return new ActionResponse(false, error, resultCode);
        }
        #endregion
    }
}
